<template>
<div>
<el-row>
	<el-form :inline="true" :model="form" >
		
		<el-form-item >
		    <el-select v-model="form.model"  placeholder="模块">
		      <el-option 
		      v-for="item in dictInfoList"
		      :label="item.label" :value="item"></el-option>
		    </el-select>
		</el-form-item>
		

		<el-form-item>
		    <el-button type="primary" @click="onSubmit">查询</el-button>
		</el-form-item>

		<el-form-item>
		    <el-button type="primary" @click="tongbu">同步</el-button>
		</el-form-item>

    </el-form>
</el-row>

<el-row>
<el-table
    :data="isSyncList"
    border
    @selection-change="handleSelectionChange"
    style="width: 100%">
    <el-table-column
      type="selection"
      width="35">
    </el-table-column>

    <el-table-column
      prop="id"
      label="接口标识"
      width="350">
    </el-table-column>

    <el-table-column
      prop="funName"
      label="接口名称"
      >
    </el-table-column>

    <el-table-column
      prop="statusCodeCN"
      label="状态"
      width="80"
      >
    </el-table-column>

    <el-table-column
      prop="desc"
      label="描述"
      width="250"
      >
    </el-table-column>
    
    <!-- <el-table-column
      label="操作"
      width="80"
      >
      <template slot-scope="scope">
        <el-button type="primary" size="mini" @click="tongbu(scope.row)">同步</el-button>
        
      </template>
    </el-table-column> -->
</el-table>
</el-row>


</div>
</template>

<script>

import { mapGetters } from 'vuex'
import http from '@/common/http'

export default {
	
	name : 'interfaceList',
	
	data () {
		return {
		  	form : {
				model : {},

				multipleSelection : [],


		  	},

		  	isSyncList : [],

			dictInfoList : [],
		}
	},

	props : {

	},

	components : {
		
	},

	computed : {
		...mapGetters([
			//'dictInfoList',
			//'isSyncList',
		]),
	},

	methods : {
		onSubmit () {
			console.log(this.form.model);

			const para = {
				fun : 'isSyncList',
				center_code : this.form.model.center_code,
				center_key : this.form.model.value,
				cb : res => {
					console.log(res);
					this.isSyncList = res;
				}
			};
			http(para);
			
		},

		handleSelectionChange (val) {

			this.multipleSelection = val;
		},

		tongbu () {
			const para = {
				fun : 'updateSysFun',
				list : this.multipleSelection,
				cb : res => {
					console.log(res);
					this.$notify({
			          title: '成功',
			          message: '同步成功',
			          type: 'success'
			        });

					this.onSubmit();
				}
			};
			http(para);
		},

		getList () {
			const para = {
				fun : 'dictInfoList',
				type : 'sys_center_type',
				requestType : 'get',
				cb : res => {
					console.log(res);
					this.dictInfoList = res;
				}
			};
			http(para);
		},
	},

	watch : {
	    
	},

	mounted () {
		this.getList();
	},

}
</script>

<style scoped>

</style>
